import React from 'react';
import { render } from 'react-dom';
import 'antd/dist/antd.css';
import { configureStore, history } from './store/configureStore';
import './index.css'
import Prompt from './components/prompt'
import Root from './containers/Root'


const store = configureStore()



document.addEventListener('DOMContentLoaded', () =>
  render(
    <Root store={store} history={history}></Root>,
    document.getElementById('root')
  )
);

Blockly.prompt = async function (message, _default, c) {
  function useState<T>(value: T): [T, (value: T) => void] {
    function set(va: T) { value = va }
    return [value, set]
  }
  const [value, setValue] = useState(_default)
  const [visible, setVisible] = useState(true)
  let bore = false
  let n = ''
  const v = (values: string) => {
    bore = true
    n = values
  }
  const data = await Prompt({ message, value, setValue, visible, setVisible }, v)
  c(data)
};